package com.lj.infoisland.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lj.infoisland.domain.po.NewsComments;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/*
 * @description 评论mapper
 * @author 龙洁
 * @create 2024-10-21 下午10:33
 */
@Mapper
public interface NewsCommentsMapper extends BaseMapper<NewsComments> {
    /**
     * 查询距离当天天数的新增评论数量count
     *
     * @param i
     * @return
     */
    @Select("SELECT COUNT(*) AS count \n" +
            "FROM news_comments \n" +
            "WHERE DATE(created_at) = DATE_SUB(CURDATE(), INTERVAL #{i} DAY);")
    Integer getWeekNewsCommentsCount(int i);
}
